defmodule IocpMonitor.Schemas.IocpLog do
  @moduledoc """
  电流盒子数据采集的数据库表对应的实体模块
  """

  use Ecto.Schema

  @primary_key {:id, :string, []}
  @derive {Poison.Encoder, only: [
    :device_address,
    :observed_at,
    :voltage,
    :amperage,
    :power,
    :consumption,
    :overcurrent1,
    :overcurrent2,
    :overvoltage,
    :undervoltage
  ]}
  schema "iocp_log" do
    field :device_address, :integer
    field :observed_at, :naive_datetime
    field :voltage, :integer
    field :amperage, :integer
    field :power, :integer
    field :consumption, :integer
    field :overcurrent1, :integer
    field :overcurrent2, :integer
    field :overvoltage, :integer
    field :undervoltage, :integer
  end
end
